package cn.tkd.client.li.reader;

import java.util.List;

import cn.lewei.client.model.DoPropertyDescDTO;
import cn.lewei.client.reader.PageReader;
import cn.tkd.client.li.model.UserDO;

import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONObject;

public class UserParser extends PageReader {
	@Override
	public ModelData parseJsonObject(JSONObject parentObj) {
		ModelData retval = super.parseJsonObject(parentObj);
		retval.set("nick", UserDO.getNickInfo((String) retval.get("nick")));
		retval.set("orderNum", retval.get("last_order_num"));
		retval.set("expressNum", UserDO.getExpressDetails((Integer) retval
				.get("last_express_num"), (String) retval.get("url_status")));
		retval.set("doingExpressNum", UserDO.getExpressDetails((Integer) retval
				.get("last_doing_express_num"), (String) retval
				.get("url_doing_express")));
		retval.set("loginNum", retval.get("last_login_num"));
		return retval;
	}

	@Override
	protected String getFlag() {
		return "user";
	}

	@Override
	protected List<DoPropertyDescDTO> getProperties() {
       return UserDO.getPropertyInfo();
	}

}
